<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../include/laypublic.jsp" %>
<%@ include file="../../include/vueComponent.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title>项目信息收集审批</title>
</head>
<link rel="stylesheet" href="${ctx}/resources/vue-element-lib/detail.css">
<body>
<div id="app">
    <div class="layui-tab layui-tab-brief" lay-filter="xqxx-tab-all">
        <ul class="layui-tab-title">
            <li id="tbglId" class="layui-this" lay-id="0">项目信息收集审批</li>
            <li id="zgysId" lay-id="1">历史审批信息</li>
            <li id="zbwjfxId" lay-id="2">审批信息</li>
        </ul>
        <div class="layui-tab-right">
            <template v-if="layId==0">
                <button type="button" class="layui-btn layui-btn-primary layui-btn-radius" @click="save(0)">驳回</button>
                <button type="button" class="layui-btn layui-btn-radius" @click="save(1)">通过</button>
            </template>
        </div>
        <div class="layui-tab-content" style="height: 100px;">
            <div class="layui-tab-item layui-show">
                <div class="container">
                    <el-form ref="formRef" label-width="140px" label-suffix="："
                             label-position="left">
                        <%--项目基础信息--%>
                        <div class="base-info">
                            <div class="title">
                                <h3>项目基础信息</h3>
                            </div>
                            <!--表单-->
                            <div>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="项目编码">
                                            <span>{{info.proCode}}</span>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="所属公司">
                                            <span>{{info.compName}}</span>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="项目名称">
                                            <x-input v-model="info.proName" name="项目名称" disabled/>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="营销经理">
                                            <span>{{info.staffName}}</span>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col position="full">
                                        <el-form-item label="项目地点">
                                            <el-select v-model="info.refProvinceId" style="width: 100px" filterable
                                                       disabled
                                                       placeholder="请选择">
                                                <el-option v-for="item in province" :key="item.id" :label="item.sname"
                                                           :value="item.id"></el-option>
                                            </el-select>

                                            <el-select v-model="info.refCityId" style="width: 100px" filterable
                                                       placeholder="请选择"
                                                       disabled>
                                                <el-option v-for="item in city" :key="item.id" :label="item.sname"
                                                           :value="item.id"></el-option>
                                            </el-select>
                                            <el-select v-model="info.refAreaId" style="width: 100px" filterable
                                                       placeholder="请选择"
                                                       disabled>
                                                <el-option v-for="item in area" :key="item.id" :label="item.sname"
                                                           :value="item.id"></el-option>
                                            </el-select>
                                            <el-input v-model="info.address" placeholder="请输入内容"
                                                      style="width: calc(100% - 312px)" disabled></el-input>
                                        </el-form-item>
                                    </x-col>

                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="项目类型">
                                            <x-select v-model="info.proTypes" :options="projectType" name="项目类型"
                                                      disabled></x-select>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="入库情况">
                                            <x-select v-model="info.isInStore" :options="storageSituation" name="入库类型"
                                                      disabled></x-select>
                                        </el-form-item>
                                    </x-col>

                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="项目业态">
                                            <x-select v-model="info.proFormat" :options="proFormaType" name="入库类型"
                                                      disabled></x-select>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="运营周期">
                                            <x-input v-model="info.omYears" name="运营周期" disabled/>
                                        </el-form-item>
                                    </x-col>

                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="项目渠道">
                                            <x-select v-model="info.fromChannel" :options="projectChannel" name="入库类型"
                                                      disabled></x-select>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="业主单位名称">
                                            <el-select v-model="info.unitId" style="width: 100%" filterable disabled
                                                       placeholder="请选择业主单位">
                                                <el-option v-for="item in owner" :key="item.id" :label="item.coopName"
                                                           :value="item.id"></el-option>
                                            </el-select>
                                        </el-form-item>
                                    </x-col>

                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="单位性质">
                                            <x-input v-model="info.coopProperty" name="单位性质" disabled/>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="内部关系">
                                            <x-input v-model="info.innerRelationship" name="内部关系" disabled/>
                                        </el-form-item>
                                    </x-col>

                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="合作周期">
                                            <x-input v-model="info.workYears" name="合作周期" disabled></x-input>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="建设周期">
                                            <x-input v-model="info.buildYears" name="建设周期" disabled></x-input>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="总投资额">
                                            <x-input v-model="info.sumAmount" name="总投资额" disabled></x-input>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col position="full">
                                        <el-form-item label="项目简介" prop="remark">
                                            <x-input v-model="info.proRemarks" name="项目简介" type="textarea" :rows="4"
                                                     disabled></x-input>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                            </div>
                        </div>
                        <%--项目合作方--%>
                        <div class="title">
                            <h3>项目合作方</h3>
                        </div>
                        <div class="unit">
                            <div class="unit_center">
                                <el-table :data="summary" style="width: 100%" border>
                                    <el-table-column prop="unit" label="合作单位" align="center">
                                        <template slot-scope="scope">
                                            <el-select v-model="scope.row.sgCoopId" filterable placeholder="请选择"
                                                       disabled>
                                                <el-option v-for="item in coopInfoList" :key="item.id"
                                                           :label="item.coopName"
                                                           :value="item.id"></el-option>
                                            </el-select>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="effect" label="单位作用" align="center">
                                        <template slot-scope="scope">
                                            <el-select v-model="scope.row.coopEffect" filterable placeholder="请选择"
                                                       disabled>
                                                <el-option v-for="item in coopEffect" :key="item.code"
                                                           :label="item.name"
                                                           :value="item.code"></el-option>
                                            </el-select>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="合作类型" align="center">
                                        <template slot-scope="scope">
                                            <el-select v-model="scope.row.cooperationType" filterable placeholder="请选择"
                                                       disabled>
                                                <el-option v-for="item in cooperationType" :key="item.code"
                                                           :label="item.name"
                                                           :value="item.code"></el-option>
                                            </el-select>
                                        </template>
                                    </el-table-column>
                                </el-table>
                            </div>
                        </div>
                        <div class="title">
                            <h3>项目投资构成</h3>
                        </div>
                        <div class="investment">
                            <div class="investment_center">
                                <el-table :data="investmentInfoVos" style="width: 100%" border ref="investment">
                                    <el-table-column prop="name" label="名称" align="center">
                                        <template slot-scope="scope">
                                            <div>{{scope.row.name}}</div>
                                        </template>
                                    </el-table-column>
                                    <el-table-column align="center" v-for="(item,index) in itemName "
                                                     :key="index">
                                        <template #header>
                                            <el-input v-model="item.name" placeholder="请输入子项" disabled></el-input>
                                        </template>
                                        <template slot-scope="scope">
                                            <template v-if="scope.row.name=='合计'">
                                                <el-input v-model="scope.row.list[index]" type="number" min="0"
                                                          placeholder="请输入金额" disabled style="color: #000"></el-input>
                                            </template>
                                            <template v-else>
                                                <el-input v-model="scope.row.list[index]" type="number" min="0"
                                                          placeholder="请输入金额" disabled></el-input>
                                            </template>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="合计" align="center" type="index" width="100">
                                        <template slot-scope="scope">
                                            <div v-if="scope.$index<=2"></div>
                                            <div v-else>{{scope.row.total?scope.row.total:'0'}}</div>
                                        </template>
                                    </el-table-column>
                                </el-table>
                            </div>
                        </div>
                        <%--回报机制--%>
                        <div class="repay">
                            <div class="title">
                                <h3>回报机制</h3>
                            </div>
                            <el-row>
                                <x-col position="full">
                                    <el-form-item label="" prop="b1">
                                        <el-radio-group v-model="info.backMech" disabled>
                                            <el-radio label="1">政府付费</el-radio>
                                            <el-radio label="2">可行性缺口补助</el-radio>
                                            <el-radio label="3">使用者付费</el-radio>
                                        </el-radio-group>
                                    </el-form-item>
                                </x-col>
                            </el-row>
                            <el-row>
                                <el-col :span="6" :offset="2" class="mr-10">
                                    <el-form-item label="工程费用下浮率">
                                        <x-input size="small" type="number" min="0" v-model="info.downRate" disabled/>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6" class="mr-10">
                                    <el-form-item label="合理利润率">
                                        <x-input size="small" type="number" min="0" v-model="info.profitRate" disabled/>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6" class="mr-10">
                                    <el-form-item label="投资回报率">
                                        <x-input size="small" type="number" min="0" v-model="info.investBackRate"
                                                 disabled/>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="6" :offset="2" class="mr-10">
                                    <el-form-item label="折现率">
                                        <x-input size="small" type="number" min="0" v-model="info.discountRate"
                                                 disabled/>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6" class="mr-10">
                                    <el-form-item label="建设期融资利率">
                                        <x-input size="small" type="number" min="0" v-model="info.finRate" disabled/>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6" class="mr-10">
                                    <el-form-item label="融资回报率">
                                        <x-input size="small" type="number" min="0" v-model="info.finBackRate"
                                                 disabled/>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="6" :offset="2" class="mr-10">
                                    <el-form-item label="资本金回报率">
                                        <x-input size="small" type="number" min="0" v-model="info.capitalBackRate"
                                                 disabled/>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6" class="mr-10">
                                    <el-form-item label="总投资额">
                                        <x-input size="small" type="number" min="0" v-model="info.sumAmount" disabled/>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6" class="mr-10">
                                    <el-form-item label="资本金比例">
                                        <x-input size="small" type="number" min="0" v-model="info.capitalPercent"
                                                 disabled/>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="6" :offset="2" class="mr-10">
                                    <el-form-item label="资本金数额">
                                        <x-input size="small" type="number" min="0" v-model="info.capitalFund"
                                                 disabled/>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6" class="mr-10">
                                    <el-form-item label="我方股权出资金额">
                                        <x-input size="small" type="number" min="0" v-model="info.stockFund" disabled/>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6" class="mr-10">
                                    <el-form-item label="我方股权比例">
                                        <x-input size="small" type="number" min="0" v-model="info.stockPercent"
                                                 disabled/>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </div>
                        <div class="title">
                            <h3>项目风险</h3>
                        </div>
                        <div class="unit">
                            <%-- <div class="unit_add">
                                 <button class="layui-btn layuiadmin-btn-admin" type="button" data-type="add" @click="addRisk">
                                     <i class="layui-icon layui-icon-add-1 layuiadmin-button-btn"></i>添加风险点
                                 </button>
                             </div>--%>
                            <div class="unit_center">
                                <%--  <div class="unit_img">
                                      <div class="item" v-for="(item,index) in riskTable" :key="index" v-if="riskTable.length>1">
                                          <img src="${ctx}/resources/images/del.png" alt="" @click="delRisk(index)">
                                      </div>
                                  </div>--%>
                                <el-table :data="riskTable" style="width: 100%" border>
                                    <el-table-column prop="unit" label="风险描述" align="center">
                                        <template slot-scope="scope">
                                            <el-input v-model="scope.row.riskDesc" placeholder="请输入风险点"
                                                      disabled></el-input>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="effect" label="风险等级" align="center">
                                        <template slot-scope="scope">
                                            <el-select v-model="scope.row.riskLevel" placeholder="请选择">
                                                <el-option v-for="item in riskLevel" :key="item.code" :label="item.name"
                                                           disabled
                                                           :value="item.code"></el-option>
                                            </el-select>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="处理策略" align="center">
                                        <template slot-scope="scope">
                                            <el-select v-model="scope.row.solveWay" placeholder="请选择">
                                                <el-option v-for="item in riskSolveWay" :key="item.code"
                                                           :label="item.name" disabled
                                                           :value="item.code"></el-option>
                                            </el-select>
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="最新进展" align="center">
                                        <template slot-scope="scope">
                                            <el-input v-model="scope.row.latestProgress" placeholder="请描述风险进展"
                                                      disabled></el-input>
                                        </template>
                                    </el-table-column>
                                </el-table>
                            </div>
                        </div>
                        <el-row>
                            <x-col position="full">
                                <el-form-item label="项目优点">
                                    <x-input v-model="info.proMerit" type="textarea" :rows="4" disabled></x-input>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col position="full">
                                <el-form-item label="其他说明">
                                    <x-input v-model="info.proOthers" type="textarea" :rows="4" disabled></x-input>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <div class="title">
                            <h3>底线标准情况</h3>
                        </div>
                        <div class="unit">
                            <div class="unit_center">
                                <el-table :data="standardTable" style="width: 100%" border>
                                    <el-table-column prop="unit" label="标准名称" align="center">
                                        <template slot-scope="scope">
                                            {{scope.row.nowName}}
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="effect" label="标准值" align="center">
                                        <template slot-scope="scope">
                                            {{scope.row.nowValue}}
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="当前进度" align="center">
                                        <template slot-scope="scope">
                                            {{scope.row.nowProgress}}
                                        </template>
                                    </el-table-column>
                                    <el-table-column prop="type" label="结论" align="center">
                                        <template slot-scope="scope">
                                            {{scope.row.resultMsg}}
                                        </template>
                                    </el-table-column>
                                </el-table>
                            </div>
                        </div>
                        <div class="title">
                            <h3>项目附件信息</h3>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label" style="width:350px;">支持pdf、excel、word、图片资料，可上传多个</label>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">项目可研报告</label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <%--                        <button type="button" class="layui-btn" type="button" id="1-upload-more">上传</button>--%>
                                    <div class="layui-upload-list" id="1-upload-more-list">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">两评一案</label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <%--                        <button type="button" class="layui-btn" type="button" id="2-upload-more">上传</button>--%>
                                    <div class="layui-upload-list" id="2-upload-more-list">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">其他资料</label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <%--                        <button type="button" class="layui-btn" type="button" id="3-upload-more">上传</button>--%>
                                    <div class="layui-upload-list" id="3-upload-more-list">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <%--审批信息--%>
                        <div class="title">
                            <h3>审批信息</h3>
                        </div>
                        <div class="approve">
                            <el-row>
                                <x-col position="left">
                                    <el-form-item label="是否继续跟踪">
                                        <x-select v-model="info.isTrack" name="继续跟踪" :options="traceOptions"></x-select>
                                    </el-form-item>
                                </x-col>
                                <x-col position="full">
                                    <el-form-item label="审批意见">
                                        <x-input v-model="auditMsg" type="textarea" :rows="4"></x-input>
                                    </el-form-item>
                                </x-col>
                            </el-row>
                        </div>
                    </el-form>
                </div>
            </div>
        </div>
    </div>
</div>
<%--<div id="app">--%>
<%--    <div class="head">--%>
<%--        <div class="left">新增项目信息</div>--%>
<%--        <div class="right">--%>
<%--            <button type="button" class="layui-btn layui-btn-primary layui-btn-radius" @click="save(0)">驳回</button>--%>
<%--            <button type="button" class="layui-btn layui-btn-radius"  @click="save(1)">通过</button>--%>
<%--        </div>--%>
<%--    </div>--%>

<%--</div>--%>
<script src="${ctx}/resources/vue-element-lib/jquery.js"></script>
<script>
    let fileArr = [];
    var staticPath = '${fileHttpPre}';
    layui.config({
        base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'set', 'upload', 'table', 'transfer', 'laydate', 'element', 'layer'], function () {
        var $ = layui.$
            , upload = layui.upload
            , table = layui.table
            , element = layui.element
            , layer = layui.layer;

        //选项卡切换监听
        element.on('tab(xqxx-tab-all)', function (data) {
            var layId = $(this).attr('lay-id');
            vm.$data.layId = layId
            if (layId === "0") {

            } else if (layId === "1") {
                loadTable(layId);
            } else if (layId === "2") {

            }
        });

        function loadTable(layId) {
            // 表单
            table.render({
                elem: '#lay-lsspxx-create-manage'
                , url: basePath + '/historyProcess/list?proCode=${proCode}'
                , cols: [[
                    {
                        field: 'startTime', title: '发起时间', width: 145, width: 155, templet: function (d) {
                            return layui.util.toDateString(d.startTime, "yyyy-MM-dd HH:mm:ss");
                        }
                    }
                    , {field: 'startRealName', title: '发起人', width: 145}
                    , {field: 'proFlowType', title: '审批阶段', width: 145}
                    , {field: 'proFlowNode', title: '审批节点', width: 145}
                    , {
                        field: 'dealTime', title: '审批日期', width: 155, templet: function (d) {
                            return layui.util.toDateString(d.dealTime, "yyyy-MM-dd HH:mm:ss");
                        }
                    }
                    , {field: 'dealName', title: '审批人', width: 160}
                    , {
                        field: 'state', title: '审批状态'
                    }
                    , {
                        title: '操作', width: 140, align: 'center', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>查看</a>';
                            return optStr;
                        }
                    }
                ]]
                , page: true
                , limit: 10
            });

            // 监听操作列
            table.on('tool(lay-lsspxx-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看
                    parent.layui.index.openTabsPage(basePath + '/historyProcess/toDetail?processId=' + data.processId, '历史流程信息 > 详情');
                }
            });
        }
        ;(function () {
            //定义构造函数
            var Upfile = function (ele, type, opt) {
                this.defaults = {
                    //elem:‘#uploadPic‘	//绑定元素
                    elem: $(ele)	//绑定元素
                    , url: basePath + '/contractInfo/uploadAtt/',
                    data: {
                        types: type
                    },
                    multiple: true,
                    accept: 'file',
                    acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf',

                    method: 'post',
                    before: function (obj) { //obj参数包含的信息
                        layer.load(); //上传loading
                    },
                    done: function (res) {
                        //如果上传失败
                        if (res.code > 0) {
                            layer.closeAll('loading'); //关闭loading
                            return layer.msg(res.msg, {icon: 7});
                        }
                        //上传完毕
                        if (res.entity != null && res.entity.length > 0) {
                            fileArr.push(res.entity[0])
                            for (var i in res.entity) {
                                var contractInfo = res.entity[i];
                                var arr = contractInfo.split("|");
                                var imgSrc = "";
                                var suffix = arr[1].substring(arr[1].lastIndexOf(".") + 1, arr[1].length);
                                if (suffix == 'jpg' || suffix == 'png') {
                                    imgSrc = "${fileHttpPre}/" + arr[3];
                                } else {
                                    imgSrc = "${ctx}/resources/images/" + suffix + ".jpg";
                                }
                                $('#' + type + '-upload-more-list')
                                    .append('<div class="layui-upload-img-div" id="upload_img_' + arr[2] + '"><img src="' + imgSrc + '" title="'
                                        + arr[1] + '" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\'' + "${fileHttpPre}"
                                        + arr[3] + '\');">查看</a></div><p>' + arr[1] + '</p><input type="hidden" value="'
                                        + contractInfo + '" id="fileAtt_' + arr[2] + '" name="fileAtts" ></input></div> ');
                            }
                        }
                    },
                    allDone: function (obj) { //当文件全部被提交后，才触发
                        layer.closeAll('loading'); //关闭loading
                    },
                    error: function () {
                        layer.closeAll('loading'); //关闭loading
                        //上传失败
                        layer.msg("上传失败，请稍后再试~", {icon: 7});
                    }
                }
                this.options = $.extend({}, this.defaults, opt);
            };

            //定义方法
            Upfile.prototype = {
                init: function () {
                    var _this = this;
                    return layui.use('upload', function () {
                        var upload = layui.upload;

                        //执行实例
                        var uploadInst = upload.render(_this.options);
                    });
                }
            };

            //在插件中使用对象
            $.fn.upfile = function (options) {
                var upfile = new Upfile(this, options);
                return upfile.init();
            }
        })();
        //上传文件
        $('#1-upload-more').upfile(1);
        $('#2-upload-more').upfile(2);
        $('#3-upload-more').upfile(3);
    });

    //删除文件
    function del(index) {
        layui.$("#fileAtt_" + index).remove();
        layui.$("#upload_img_" + index).remove();
    }

    //根据url查看文件
    function showImg(url) {
        var openWin = window.open(url, '', 'left=410,height=768, width=1024, top=200,  toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
    }

    /*核心*/
    var vm = new Vue({
        el: '#app',
        data() {
            return {
                layId: '',
                procNodeList: [],
                tempNodeList: [],
                auditMsg: '',//审批意见
                // auditMsg: '',
                id: '',
                options: [],
                info: {},
                coopInfoList: [],//合作单位
                coopEffect: [],//单位作用
                cooperationType: [],//合作类型
                proFormaType: [],//项目业态
                projectChannel: [],//项目渠道
                projectType: [],//项目类型
                riskLevel: [],//风险等级
                storageSituation: [],//入库情况
                province: [],//省
                city: [],//市
                area: [],//区
                summary: [],//合作单位 sgCoopId 合作单位ID---coopEffect 单位作用 --- setCooperationType --合作类型

                riskSolveWay: [],//处理策略
                //项目类型
                projectType: [],
                //入库情况
                storageSituation: [],
                projectInfo: {},
                // 是否追踪
                traceOptions: [
                    {name: '继续跟踪', code: 0},
                    {name: '停止跟踪', code: 1}
                ],
                summary: [], // sgCoopId 合作单位ID---coopEffect 单位作用 --- setCooperationType --合作类型

                itemName: [{name: '子项名称1'},],
                investmentInfoVos: [
                    {name: '合作周期', list: [0], total: 0,},
                    {name: '建设周期', list: [0], total: 0,},
                    {name: '运营周期', list: [0], total: 0,},
                    {name: '1.建安工程费用', list: [0], total: 0,},
                    {name: '2.设备购置费用', list: [0], total: 0,},
                    {name: '3.工程建设其他', list: [0], total: 0,},
                    {name: '3.1征地拆迁费', list: [0], total: 0,},
                    {name: '4.预备费', list: [0], total: 0,},
                    {name: '5.建设期利息', list: [0], total: 0,},
                    {name: '合计', list: [0], total: 0,}],
                owner: [],      //业主单位
                //项目风险点
                riskTable: [],//riskDesc:风险描述 riskLevel:等级 solveWay:处理策略 latestProgress:最新进展
                //底线标准情况
                standardTable: []//name:标准名称 value:标准值 schedule:当前进度  conclusion:结论
            }
        },
        created() {
            let that = this;
            this.getDrop();//获取下拉
            this.getAddress()//获取地址
            this.queryCoopInfo();//获取业主单位
            that.id = "${id}";
            if (that.id) {
                that.queryCollectDetail();
            }
        },
        mounted() {

        },
        methods: {
            // 查看详情
            queryCollectDetail() {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/collectProject/queryCollectDetail',  //请求数据接口
                    data: {
                        id: that.id
                    },
                    success: function (result) {
                        console.log(result);
                        that.info = result.entity.projectInfo;
                        that.info.isTrack = Number(that.info.isTrack);
                        that.getAddress(that.info.refProvinceId, 1)//获取地址
                        that.getAddress(that.info.refCityId, 2)//获取地址
                        that.riskTable = result.entity.riskTable;
                        that.summary = result.entity.summaryCoops;
                        that.standardTable = result.entity.standardTable;
                        console.log(that.standardTable)
                        that.showFile(result.entity.fileAtt);
                        if (result.entity.investmentInfoVos.length > 0) {
                            that.itemName = result.entity.itemName;
                            that.investmentInfoVos = result.entity.investmentInfoVos;
                        }
                        let arr = [];
                        that.summary.map((el, index) => {
                            if (el.coopEffect == -1) {
                                arr = that.summary.splice(index, 1)
                            }
                        })
                        console.log(arr)
                        that.info.unitId = arr[0].sgCoopId;
                    }
                });
            },
            queryCoopInfo() {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/proSell/queryCoopInfo',  //请求数据接口
                    data: {},
                    success: function (result) {
                        console.log(result);
                        that.owner = result;
                    }
                });
            },
            showFile(fileList) {
                if (fileList && fileList.length > 0) {
                    fileArr = fileList;
                    for (let i in fileList) {
                        let contractInfo = fileList[i];
                        let arr = contractInfo.split("|");
                        let imgSrc = "";
                        let suffix = arr[1].substring(arr[1].lastIndexOf(".") + 1, arr[1].length);
                        if (suffix == 'jpg' || suffix == 'png') {
                            imgSrc = "${fileHttpPre}/" + arr[3];
                        } else {
                            imgSrc = "${ctx}/resources/images/" + suffix + ".jpg";
                        }
                        $('#' + arr[0] + '-upload-more-list')
                            .append('<div class="layui-upload-img-div" id="upload_img_' + arr[2] + '"><img src="' + imgSrc + '" title="'
                                + arr[1] + '" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\'' + "${fileHttpPre}"
                                + arr[3] + '\');">查看</a></div><p>' + arr[1] + '</p><input type="hidden" value="'
                                + contractInfo + '" id="fileAtt_' + arr[2] + '" name="fileAtts" ></input></div> ');
                    }
                }
            },
            error(text) {
                this.$message({
                    message: text,
                    type: 'warning'
                });
            },
            //获取下拉
            getDrop() {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/collectProject/getDrop',  //请求数据接口
                    data: {},
                    success: function (result) {
                        that.coopInfoList = result.entity.coopInfoList;//合作单位
                        that.coopEffect = result.entity.coopEffect;//单位作用
                        that.cooperationType = result.entity.cooperationType;//合作类型
                        that.proFormaType = result.entity.proFormaType;//项目业态
                        that.projectChannel = result.entity.projectChannel;//项目渠道
                        that.projectType = result.entity.projectType;//项目类型
                        that.riskLevel = result.entity.riskLevel;//风险等级
                        that.riskSolveWay = result.entity.riskSolveWay;//处理策略
                        that.storageSituation = result.entity.storageSituation;//入库情况
                        //底线标准情况
                        // that.standardTable = result.entity.standardTable && result.entity.standardTable.length > 0 ? result.entity.standardTable : [];//入库情况
                    }
                });
            },
            //获取地址
            getAddress(id, type = 0) {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/collectProject/getAddress',  //请求数据接口
                    data: {
                        id: (id ? id + ',' : '') + (type ? type : '0')
                    },
                    success: function (result) {
                        console.log(result)
                        if (type == 0) {
                            that.province = result.entity;//省
                            console.log(111)
                            console.log(that.province)
                        } else if (type == 1) {
                            that.city = result.entity//市
                        } else {
                            that.area = result.entity//区
                        }
                    }
                });
            },
            //保存
            save(type) {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/collectProject/auditProcess',  //请求数据接口
                    data: {
                        id: that.info.preId,  //info里面获取
                        processId: that.info.processId,  //info里面获取
                        status: type,  //0=驳回，1=通过
                        auditMsg: that.auditMsg  //填写的审批信息
                    },
                    success: function (result) {
                        if (result.success) {
                            that.$message({
                                message: result.msg,
                                type: 'success'
                            });
                        } else {
                            that.$message.error(result.msg);
                        }
                    }
                });
            }
        }
    })
</script>
</body>
</html>

